package com.shoponline.dao;

public abstract class DAOFactory {
	 
	
	private static DAOFactory fac;
    /**
     * Creates a standalone DAOFactory that returns unmanaged DAO
     * beans for use in any environment Hibernate has been configured
     * for. Uses HibernateUtil/SessionFactory and Hibernate context
     * propagation (CurrentSessionContext), thread-bound or transaction-bound,
     * and transaction scoped.
     */
    public static final Class HIBERNATE = com.shoponline.dao.hibernate.HibernateDAOFactory.class;
 
    /**
     * Factory method for instantiation of concrete factories.
     */
    public static DAOFactory instance(Class factory) {
    	
        try {
            
        	fac = (DAOFactory)factory.newInstance();
        	if(fac!=null){
        		System.out.println("Success create DAOFactory:"+factory);
        	}else{
        		
        		System.out.println("Could't createDAOfactory");
        	}
        	return fac;
           
            
        } catch (Exception ex) {
        	
            throw new RuntimeException("Couldn't create DAOFactory: " + factory);
        }
    }
 
    // Add your DAO interfaces here
    public abstract UserDAOTest getUserDAO();
 
}
